package com.campus.controller;

import com.campus.common.JWTUtil;
import com.campus.common.core.Pager;
import com.campus.common.core.Result;
import com.campus.model.TCourse;
import com.campus.model.TSysUser;
import com.campus.model.dto.TCourseCreateDto;
import com.campus.service.ICourseService;
import com.campus.service.ISysUserService;
import com.campus.service.IUserRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/course")
@Api(tags = "课程管理")
public class CourseController {

    @Autowired
    private ICourseService courseService;

    @PostMapping("/create")
    @ApiOperation("创建课程")
    public Result<Integer> createCourse(@RequestBody @Validated TCourseCreateDto courseCreateDto) {
        return Result.success(courseService.createCourse(courseCreateDto));
    }

    @GetMapping("/list")
    @ApiOperation("获取课程列表")
    public Result<TCourse> listCourse(Pager pager) {
        return Result.success(courseService.getCourseList(pager));
    }


}